package com.liwq.base.lockSupport;

import java.util.concurrent.locks.LockSupport;

/**
 * @author : liwq
 * @version : 1.0
 * @date : 2023/2/27
 **/
public class MyLockSupportTest {
    public static void main(String[] args) {

        Thread a = new Thread(()->{
            System.out.println("线程1 进来了，阻塞。。。。。。");
            LockSupport.park();
            System.out.println("线程1被唤醒");

        },"线程1");
        a.start();



        Thread b = new Thread(()->{
            System.out.println("线程2 进来了。。。。。。");
            LockSupport.unpark(a);
            System.out.println("开始唤醒线程1");
        },"线程2");
        b.start();

    }
}
